%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Reference:
%Mike Novey and T. Adali, "The complex generalized Gaussian Distribution---
% charachterization, generation, and estimation" in
% (To appear ) IEEE Trans. Signal Proc.,
% June 21, 2009
% Function to return a vector (N X 1) of 
% complex generalized gaussian random variables with augmented
% covariance matrix C = E{xx^H}
% and shape parameter c where c = 1 is Gaussian
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
function [X] = getComplexGGD(N,C,c)
 
X1 = zeros( N,1);
cc = c*2;
for i = 1:N
    %cc = 2 is Gaussian
    X1(i) = gamrnd(2/cc,1)^(1/cc) * exp(j*2*pi*rand);
end
cNorm = (gamma(2/c)/(gamma(1/c))); %unit complex norm
X1 =X1*(1/sqrt(cNorm)); %Complex to unit variance
Xaug = [X1 conj(X1)]';
 
X = C^(1/2)*Xaug;  %force covariance 

